<%@ Page EnableViewState="false" Language="C#" MasterPageFile="~/MyMasterPage.master"
    AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <%  
        //this path name required coz when url re-writing then the actual url makes conflit with the virtual one
        // and navigation throw IIS is easier with this way.
        // SiteRoorDir contant the location of the directory where project exits

        string siteDirName = System.Configuration.ConfigurationManager.AppSettings["siteDirName"].ToString();
        string extension = System.Configuration.ConfigurationManager.AppSettings["extension"].ToString(); 

    %>
    <div class="right_side">
        <div class="nav">
            <h2>
                Latest News:
            </h2>
            <ul>
                <asp:SqlDataSource ID="SqlDataSource5" runat="server" ConnectionString="<%$ ConnectionStrings:Personal %>"
                    SelectCommand="SELECT TOP(2) [id], [NewsTitle], [NewsCaption], [NewsDetails],REPLACE(NewsTitle, ' ', '-') AS NewsTitleLinks , [NewsDate],DAY(NewsDate) AS date, MONTH(NewsDate) AS month, YEAR(NewsDate) AS year, [IsPublished] FROM [News] ORDER BY [NewsDate] Desc">
                </asp:SqlDataSource>
                <asp:Repeater ID="Repeater2" runat="server" DataSourceID="SqlDataSource5">
                    <ItemTemplate>
                        <li>
                            <% // the resion of intiate this items inside if this variables are defined
                                // outside of the item template then the scope cannot found.
                                string siteDirName = System.Configuration.ConfigurationManager.AppSettings["siteDirName"].ToString();
                                string extension = System.Configuration.ConfigurationManager.AppSettings["extension"].ToString(); 
                            %>
                            <a href="<%=siteDirName%>News/<%# Eval("month")%>/<%# Eval("date")%>/<%# Eval("year")%>/<%# Eval("id")%>/<%# Eval("NewsTitleLinks")%><%=extension %>">
                                <%# Eval("NewsTitle")%>
                            </a></li>
                    </ItemTemplate>
                </asp:Repeater>
                 <li><a href='<%=siteDirName%>News.aspx'>[more]</a></li>
            </ul>
            
            <br />
            <h2>
                Latest Posts:</h2>
            <ul>
                <asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:Personal %>"
                    SelectCommand="SELECT TOP (2) BlogID, PostTitle AS PostTitleLinks, REPLACE(PostTitle, ' ', '-') AS PostTitle, 
                                      DAY(PostDate) AS date, MONTH(PostDate) AS month, YEAR(PostDate) AS year, PostContent, PostDate,
                                       PostedBy, PostCaption FROM Blog ORDER BY PostDate DESC, PostTitle">
                </asp:SqlDataSource>
                <asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource3">
                    <ItemTemplate>
                        <li>
                            <% string siteDirName = System.Configuration.ConfigurationManager.AppSettings["siteDirName"].ToString(); %>
                            <% string extension = System.Configuration.ConfigurationManager.AppSettings["extension"].ToString(); %>
                            <a href="<%=siteDirName%>Blog/<%# Eval("date")%>/<%# Eval("month")%>/<%# Eval("year")%>/<%# Eval("BlogID")%>/<%# Eval("PostTitle")%><%=extension%>">
                                <%# Eval("PostTitleLinks")%></a> </li>
                    </ItemTemplate>
                </asp:Repeater>
            </ul>
             <br />
            <h2>Latest Proejcts:</h2>
            <ul>
                <asp:SqlDataSource ID="SqlDataSource7" runat="server" ConnectionString="<%$ ConnectionStrings:Personal %>"
                      SelectCommand="SELECT TOP (2) [id], [ProName],REPLACE(ProName, ' ', '-') AS ProTitle, [ProCaption], [ProContent], [ProTechLang], [ProDatabase], [ProType], [ProTools], [ProURL], [ProCatagory] FROM [Projects] WHERE ([ProCatagory] = @ProCatagory) ORDER BY [ProDisplaySerial]">
                      <SelectParameters>
                          <asp:Parameter DefaultValue="ind" Name="ProCatagory" Type="String" />
                      </SelectParameters>
                  </asp:SqlDataSource>
                <asp:Repeater ID="Repeater3" runat="server" DataSourceID="SqlDataSource7">
                    <ItemTemplate>
                        <li>
                            <% string siteDirName = System.Configuration.ConfigurationManager.AppSettings["siteDirName"].ToString(); %>
                            <% string extension = System.Configuration.ConfigurationManager.AppSettings["extension"].ToString(); %>
                            <a href="<%=siteDirName%>Projects/<%# Eval("id")%>/<%# Eval("ProTitle")%><%=extension%>">
                                <%# Eval("ProName")%></a> </li>
                    </ItemTemplate>
                </asp:Repeater>
            </ul>
            
            
            <br />
            
            <h2>
                Quick Contact:</h2>
            <ul>
                
                    <li><a href="<%=siteDirName %>Contact/Contact<%=extension%>"><strong>Cell:</strong>+880-018-17097284</a></li>
                    <%--<li><a href="<%=siteDirName %>Contact/Contact<%=extension%>"><strong>Phone:</strong>+880-02-912-3942</a></li></ul>--%>
                    <li><a href="<%=siteDirName %>Contact/Contact<%=extension%>"><strong>E-Mail:</strong>saiketpodder@yahoo.com</a></li>
<%--                    <li><a href="<%=siteDirName %>Contact/Contact<%=extension%>"><strong>Mail: </strong>
                    Eastern Lakecicus,<br />Flat#503,House#62,<br />Lakecircus,Kolabaghan,<br />Dhaka 1205,Bangladesh</a></li>--%>

            <br />

            
            <h2>
                Online Profiles:</h2>
            <ul>
                <li><a target="_blank" href="http://www.linkedin.com/in/saiket">
                    <img src="http://www.linkedin.com/img/webpromo/btn_viewmy_160x33.gif" width="160"
                        height="33" alt="View SAIKET PODDER's profile on LinkedIn" /></a></li>
                <li>
                    <div style="width: 176px; text-align: left">
                        <a style="font-size: 10px; color: #66CCFF; text-decoration: none" href="http://twitter.com/saiket">
                            follow saiket at http://twitter.com</a>
                        <embed src="http://twitter.com/flash/twitter_badge.swf" flashvars="color1=6737151&type=user&id=43164305"
                            quality="high" width="160" height="176" name="twitter_badge" align="middle" allowscriptaccess="always"
                            wmode="transparent" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /><br>
                    </div>
                </li>
                <li><a href="http://www.facebook.com/saiket" title="Saiket Kumar Podder" target="_TOP">
                    <img width="160" src="http://badge.facebook.com/badge/617236137.1579.776685229.png"
                        alt="Saiket Kumar Podder" style="border: 0px;" /></a> </li>
            </ul>
            <br />
            <br />
            <h2> 
                RSS Feeds:</h2>
            <ul>
                <li><a target="_blank" href='<%=siteDirName %>media/feeds/BlogRSS.xml'>
                    <img alt='click here to blog feed' title='click here to load feed' src='<%=siteDirName %>media/feeds/rss.png' />
                    <span style="vertical-align: top"><b>Blog Feed</b></span> </a></li>
                <li><a href="http://www.addthis.com/feed.php?pub=saiket&h1=<%=siteDirName %>media/feeds/BlogRSS.xml"
                    target="_blank" title="Subscribe Blog Feed using any feed reader!">
                    <img src="http://s9.addthis.com/button1-fd.gif" width="125" height="16" border="0"
                        alt="Subscribe Blog Feed using any feed reader!" />
                </a></li>
                <li><a target="_blank" href='<%=siteDirName %>media/feeds/NewsRSS.xml'>
                    <img alt='click here to news feed' title='click here to news feed' src='<%=siteDirName %>media/feeds/rss.png' />
                    <span style="vertical-align: top"><b>News Feed</b></span> </a></li>
                <li><a href="http://www.addthis.com/feed.php?pub=saiket&h1=<%=siteDirName %>media/feeds/NewsRSS.xml"
                    target="_blank" title="Subscribe News Feed using any feed reader!">
                    <img src="http://s9.addthis.com/button1-fd.gif" width="125" height="16" border="0"
                        alt="Subscribe News Feed using any feed reader!" />
                </a></li>
            </ul>
            <br />
            <br />
        </div>
    </div>
    <div class="left_side" style="text-align: justify">
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:Personal %>"
            SelectCommand="SELECT * FROM [Content] WHERE (([pageName] = @pageName) AND ([itemName] = @itemName)) and itemName='intro'">
            <SelectParameters>
                <asp:Parameter DefaultValue="Default" Name="pageName" Type="String" />
                <asp:Parameter DefaultValue="intro" Name="itemName" Type="String" />
            </SelectParameters>
        </asp:SqlDataSource>
        <asp:DataList ID="DataList1" runat="server" DataKeyField="pageName" DataSourceID="SqlDataSource1">
            <ItemTemplate>
                <h2>
                    <asp:Label ID="itemTitleLabel" runat="server" Text='<%# Eval("itemTitle") %>'></asp:Label></h2>
                <h3>
                    <asp:Label ID="Label1" runat="server" Text='<%# Eval("itemCaption") %>'></asp:Label></h3>
                <div class="padding" style="text-align: justify">
                    <% string siteDirName = System.Configuration.ConfigurationManager.AppSettings["siteDirName"].ToString(); %>
                    <% string extension = System.Configuration.ConfigurationManager.AppSettings["extension"].ToString(); %>
                    <asp:HiddenField ID="HiddenField1" Value='<%# Eval("imageName") %>' runat="server">
                    </asp:HiddenField>
                    <%
                        /*
                         * this snap of code is written to ensure that if the item have a imagecontent only
                         * that time image control with execute otherwise not.
                         * 
                         * when it is developed according to KB there is no cool way to take the image name
                         * from itemlist and thats why hidden field used
                         */
                        HiddenField hf = (HiddenField)DataList1.Items[0].FindControl("HiddenField1");
                        string imageName = hf.Value.ToString();
                        if (imageName != null && imageName != "")
                        {          
                    %>
                    <div class="img">
                        <img src='<%=siteDirName%>media/common/<%# Eval("imageName") %>' alt="Image of SAIKET KUMAR PODDER" />
                    </div>
                    <%} %>
                    <asp:Label ID="itemContentLabel" runat="server" Text='<%# Eval("itemContent") %>'></asp:Label>
                </div>
                <p class="date">
                    <%--   <asp:Label ID="Label3" runat="server" Text='<%# Eval("NewsDate") %>'></asp:Label>--%>
                </p>
            </ItemTemplate>
        </asp:DataList>
        <br />
        <p>
            [Latest News]
        </p>
        <asp:DataList ID="DataList3" runat="server" DataSourceID="SqlDataSource4">
            <ItemTemplate>
                <% string siteDirName = Application["siteDirName"].ToString(); %>
                <% string extension = Application["extension"].ToString(); %>
                <h2>
                    <asp:Label ID="NewsTitleLabel" runat="server" Text='<%# Eval("NewsTitle") %>'></asp:Label></h2>
                <h3>
                    <asp:Label ID="NewsCaptionLabel" runat="server" Text='<%# Eval("NewsCaption") %>'></asp:Label></h3>
                <div class="padding" style="text-align: justify">
                    <asp:HiddenField ID="HiddenField1" Value='<%# Eval("PhotoAvail") %>' runat="server">
                    </asp:HiddenField>
                    <%
                        /*
                         * this snap of code is written to ensure that if the item have a imagecontent only
                         * that time image control with execute otherwise not.
                         * 
                         * when it is developed according to KB there is no cool way to take the image name
                         * from itemlist and thats why hidden field used
                         */
                        HiddenField hf = (HiddenField)DataList3.Items[0].FindControl("HiddenField1");
                        string PhotoAvail = hf.Value.ToString();
                        if (PhotoAvail.Equals("True") == true)
                        {
                          
                    %>
                    <div class="img">
                        <img alt='<%# Eval("NewsTitle") %>' src="<%=siteDirName %>media/news/<%# Eval("id")%>.png" /></div>
                    <%} %>
                    <asp:Label ID="NewsDetailsLabel" runat="server" Text='<%# Eval("NewsDetails") %>'></asp:Label>
                </div>
                <p class="date">
                    <asp:Label ID="Label3" runat="server" Text='<%# Eval("NewsDate") %>'></asp:Label>
                    <br />
                    <a href='<%=siteDirName%>News.aspx'>[more]</a>
                </p>
            </ItemTemplate>
        </asp:DataList>
        <p> <span style="font-weight:bold" >[Latest Blog Post]</span></p>
        <asp:SqlDataSource ID="SqlDataSource4" runat="server" ConnectionString="<%$ ConnectionStrings:Personal %>"
            SelectCommand="SELECT TOP(1) * FROM [News] order by NewsDate DESC"></asp:SqlDataSource>
        <asp:DataList ID="DataList2" runat="server" DataSourceID="SqlDataSource2" Width="496px"
            OnItemDataBound="DataList2_ItemDataBound">
            <ItemTemplate>
                <% string extension = System.Configuration.ConfigurationManager.AppSettings["extension"].ToString(); %>
                <% string siteDirName = System.Configuration.ConfigurationManager.AppSettings["siteDirName"].ToString(); %>
                <h2>
                    <asp:Label ID="PostTitleLabel" runat="server" Text='<%# Eval("PostTitle") %>'></asp:Label></h2>
                <h3>
                    <asp:Label ID="PostCaptionLabel" runat="server" Text='<%# Eval("PostCaption") %>'></asp:Label>
                    Tags:<asp:Label ID="Label3" runat="server" Text='<%# Eval("PostTags") %>'></asp:Label></h3>
                <div class="padding" style="text-align: justify">
                    <div class="img">
                        <img src="<%=siteDirName%>media/blog/<%# Eval("BlogID") %>.png" />
                    </div>
                    <asp:Label ID="PostContentLabel" runat="server" Text='<%# Eval("PostContent") %>'></asp:Label>
                </div>
                <p class="date">
                    <input id="title" runat="server" type="hidden" value='<%# Eval("PostTitle") %>' />
                    <input id="permaLink" runat="server" type="hidden" value='<%# Eval("date")+"/"+Eval("month")+"/"+Eval("year")+"/"+Eval("BlogID")+"/"+Eval("PostTitleLinks")%>' />
                    <input id="publisher" runat="server" type="hidden" value='<%# Eval("PostedBy") %>' />
                    <%-- the book mark level is filled in DataList1_ItemDataBound --%>
                    <asp:Label CssClass="bookmark" ID="bookmark1" runat="server"></asp:Label><a href='<%=siteDirName %>Post/Comments/<%# Eval("BlogID") %>/<%# Eval("PostTitleLinks") %><%=extension%>'>Comments(<%# Eval("CommentCount")%>)</a>
                    <%--<asp:LinkButton ID="LinkButton1" runat="server">Comments(<%# Eval("CommentCount")%>)</asp:LinkButton> --%>|
                    Posted By
                    <asp:Label ID="PostedByLabel" runat="server" Text='<%# Eval("PostedBy") %>'></asp:Label>
                    |
                    <asp:Label ID="Label2" runat="server" Text='<%# Eval("PostDate") %>'></asp:Label>
                    <br />
                    <a href='<%=siteDirName%>Blog/Blog.aspx'>[more]</a>
                </p>
            </ItemTemplate>
        </asp:DataList>
        <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:Personal %>"
            SelectCommand="SELECT TOP (1) BlogID, PostTitle, REPLACE(PostTitle, ' ', '-') AS PostTitleLinks,
                                                   PostContent, PostDate,DAY(PostDate) AS date,  MONTH(PostDate) AS month, YEAR(PostDate) AS year,
                                                    PostedBy, PostCaption,PostTags, (SELECT COUNT(CommentID) AS Expr1 FROM BlogComment WHERE (Blog.BlogID = BlogID)
                                                     AND (IsPublished='True')  ) AS CommentCount FROM Blog ORDER BY PostDate DESC, PostTitle">
        </asp:SqlDataSource>
        
        
        
        
               <p> <span style="font-weight:bold" > [Latest Projects]</span></p>
                   <asp:DataList ID="DataList4" runat="server" DataSourceID="SqlDataSource6">
                      <ItemTemplate>
                          <h2><a target="_blank" href="<%# Eval("ProURL") %>"><%# Eval("ProName") %></a> </h2>
                          <h3><%# Eval("ProCaption") %><a target="_blank" href="<%# Eval("ProURL") %>"> [<%# Eval("ProURL") %>]</a></h3>
                            <div class="padding" style="text-align: justify">
                                <div class="img"><a target="_blank" href="<%# Eval("ProURL") %>" ><img width="152" height="138" alt='<%# Eval("ProName") %>' title='<%# Eval("ProName") %>'  src="<%=Application["siteDirName"].ToString() %>media/career/<%# Eval("id") %>.png" /></a></div>
                                    <%# Eval("ProContent") %><br /><br/>
                                 <table>
                                    <tr> <td><b>Language/Technologies:</b></td> <td><%# Eval("ProTechLang") %></td> </tr>
                                    <tr> <td> <b>Database:</b></td>              <td ><%# Eval("ProDatabase") %> <br/></td> </tr>
                                    <tr> <td><b>Project Type:</b></td>           <td><%# Eval("ProType") %></td> </tr>
                                    <tr> <td><b>Tools:</b></td>           <td><%# Eval("ProTools")%></td> </tr>
                                </table>                     
                          </div>                         
                          <p class="date"></p>
                          <br />
                      </ItemTemplate>
               </asp:DataList><asp:SqlDataSource ID="SqlDataSource6" runat="server" ConnectionString="<%$ ConnectionStrings:Personal %>"
                      SelectCommand="SELECT TOP (1) [id], [ProName], [ProCaption], [ProContent], [ProTechLang], [ProDatabase], [ProType], [ProTools], [ProURL], [ProCatagory] FROM [Projects] WHERE ([ProCatagory] = @ProCatagory) ORDER BY [ProDisplaySerial]">
                      <SelectParameters>
                          <asp:Parameter DefaultValue="ind" Name="ProCatagory" Type="String" />
                      </SelectParameters>
                  </asp:SqlDataSource>
                    
        
        
        
    </div>
</asp:Content>
